package linear;

public class LinkedListUtil {
    public static class ListNode {
        public int val;
        public ListNode next;

        public ListNode(int x) {
            val = x;
        }
    }

    public static void printLinkedList(ListNode head) {
        while (head != null) {
            System.out.print(head.val + " ->");
            head = head.next;
        }
        System.out.println("");
    }
}
